Skip to content

Handle file descriptors and unnamed streams in prediction inputs - #483

Open
Twiink wants to merge 1 commit into
replicate:mainfrom
Twiink:fix/temporary-file-base64-20261127-r3
Open

Twiink wants to merge 1 commit into
replicate:mainfrom
Twiink:fix/temporary-file-base64-20261127-r3

Conversation

@Twiink

@Twiink Twiink commented Nov 27, 2026

Copy link
Copy Markdown

Passing a temporary file as a prediction input can fail before the request is sent. An unrolled spool can have a null name and a handle opened from a file descriptor has an integer name. The default upload passes that value to basename, and base64 encoding passes it to guess_type.

Use the path basename when the handle has a filesystem name, and the existing fallback filename otherwise. Both encoding strategies preserve the file bytes. The regression checks the actual multipart and prediction payloads for synchronous and asynchronous requests.

Python 3.12: 166 tests passed, 6 skipped. On Python 3.10 the 12 input cases passed. Ruff lint, formatting and Pyright passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant